var express = require('express');
var router = express.Router();
const userService = require('../service/userService')

/* GET users listing. */
router.post('/login', function(req, res, next) {
  const user ={
    username:req.body.username,
    password:req.body.password
  }
  userService.login(user,(responseMessage)=>{
    res.json(responseMessage);
  })
});


router.get('/pers',(req,res)=>{
    let roleId = req.query.roleId;
    userService.findPermissionsByRoleId(roleId,(rows)=>{
       res.json(rows);
    })

})

module.exports = router;
